@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";

	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});

	function initGrid(){
		var grid_url = ctx + "/suppliers/list";
		var _colnames = ["主键",
			"供应商",
			"供应商编号",
			"地址",
			"联系人",
			"联系方式",
			"审核操作"
		];
		var _colmodel = [{name:"id", index:"id",hidden:true, width:100},
			{name:"name", index:"name", width:100},
			{name:"code", index:"code", width:100},
			{name:"address", index:"address", width:100},
			{name:"concat", index:"concat", width:100},
			{name:"tel", index:"tel", width:100},
			{name:"tel", index:"tel", width:100,formatter:function (value, row, index) {
				return '<a href="#" class="btn btn-btn btn-success btn-xs" onclick="pass('+"'"+index.id+"'"+')">'+"通过"+'</a>&nbsp;'+
						'<a href="#" class="btn btn-btn btn-danger btn-xs" onclick="back('+"'"+index.id+"'"+')">'+"驳回"+'</a>';
			}}
		];

		jQuery(grid_selector).jqGrid({
			url : grid_url,
			shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel,
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id",
				where:"{ustatus:3}",
				order : "desc"}
		});
	}
</script>


<!-- 配置 grid -->
<div class="row">
		<!-- grid -->
		<table id="grid-table"></table>
		<!-- 分页-->
		<div id="grid-pager"></div>
	</div>
</div>


<script>




	pass=function (ids) {
		layer.confirm("是否通过审核！", {
			btn: ['确定','取消'] //按钮
		}, function(){
			ajaxData = {id:ids,pass:1};
			$.post("/putin/pass",ajaxData,function (res) {
				if(res["success"]){
					layer.msg("操作成功！", {shift: -1,time:500,end:function () {
						jQuery("#grid-table").trigger("reloadGrid");
					}});
				}
			});
		});
	}
	back=function (ids) {
		layer.confirm("是否驳回申请！", {
			btn: ['确定','取消'] //按钮
		}, function(){
			ajaxData = {id:ids,pass:2};
			$.post("/putin/pass",ajaxData,function (res) {
				if(res["success"]){
					layer.msg("操作成功！", {shift: -1,time:500,end:function () {
						jQuery("#grid-table").trigger("reloadGrid");
					}});
				}
			});
		});



	}
</script>
<!-- 引入所需的js -->
@include("/common/_listscript.html"){}

@}	